<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    
    <form class="layui-form" id="admin">
      <input name="id" type="hidden" value="{$data.id}" >
      <div class="layui-form-item">
        <label class="layui-form-label">楼号</label>
        <div class="layui-input-inline">
          <input  lay-verify="required" disabled placeholder="请输入楼号" autocomplete="off" class="layui-input" type="text" value="{$data.louhao}">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">拆迁编号</label>
        <div class="layui-input-inline">
          <input name="chainum" lay-verify="required" placeholder="请输入拆迁编号" autocomplete="off" class="layui-input" type="text" value="{$data.chainum}">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">评估编号</label>
        <div class="layui-input-inline">
          <input name="pingnum" lay-verify="required" placeholder="请输入评估编号" autocomplete="off" class="layui-input" type="text" value="{$data.pingnum}">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">户主姓名</label>
        <div class="layui-input-inline">
          <input name="name" lay-verify="required" placeholder="请输入户主姓名" autocomplete="off" class="layui-input" type="text"  value="{$data.name}" >
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">家庭成员</label>
        <div class="layui-input-inline">
          <input name="family" lay-verify="required" placeholder="请输入家庭成员" autocomplete="off" class="layui-input" type="tel"  value="{$data.family}" >
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">与户主关系</label>
        <div class="layui-input-inline">
          <input name="relation" lay-verify="required" readonly value="户主" autocomplete="off" class="layui-input" type="text" {notempty name=" $data.relation"}value="{ $data.relation}" >
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-inline">
          <select name="sex" lay-filter="aihao">
            <option>请选择性别</option>
           
            {if $data.sex eq '男'}
              <option value="男" selected>男</option>
              <option value="女">女</option> 
            {else /}
              <option value="是" >是</option>
              <option value="否" selected> 否</option>  
            {/if}
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-inline">
          <input name="age" lay-verify="required" placeholder="请输入年龄" autocomplete="off" class="layui-input" type="text" value="{$data.age}" >
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">身份证号</label>
        <div class="layui-input-inline">
          <input name="idcar" lay-verify="required" placeholder="请输入身份证号" autocomplete="off" class="layui-input" type="text" value="{$data.idcar}" >
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">是否基本村民</label>
        <div class="layui-input-inline">
          <select name="iscun" lay-filter="aihao">
            <option>请选择</option>
            {if $data.iscun eq '是'}
              <option value="是" selected>是</option>
              <option value="否">否</option>  
            {else /}
              <option value="是" >是</option>
              <option value="否" selected> 否</option>  
            {/if}
          
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">拆迁状态</label>
        <div class="layui-input-inline">
          <select name="status" lay-filter="aihao">
            <option>请选择</option>
            {if $data.status eq 1}
              <option value="1" selected>已完成</option>
              <option value="2">已签</option>
              <option value="3">已联系</option>
              <option value="4">未联系</option>
            {elseif $data.status eq 2}
              <option value="1" >已完成</option>
              <option value="2" selected>已签</option>
              <option value="3">已联系</option>
              <option value="4">未联系</option>
            {elseif $data.status eq 3}
              <option value="1" >已完成</option>
              <option value="2" >已签</option>
              <option value="3" selected>已联系</option>
              <option value="4">未联系</option>
            {elseif $data.status eq 4}
              <option value="1" >已完成</option>
              <option value="2" >已签</option>
              <option value="3" >已联系</option>
              <option value="4" selected>未联系</option>
            {/if}
            
            
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>
        var message;
        layui.config({
            base: '__JS__/',
            version: '1.0.1'
        }).use(['app', 'message'], function() {
            var app = layui.app,
                $ = layui.jquery,
                layer = layui.layer;
            //将message设置为全局以便子页面调用
            message = layui.message;
            //主入口
            app.set({
                type: 'iframe'
            }).init();
        });
    </script>
    <script>
      layui.use(['layer', 'form'], function() {
          var layer = layui.layer,
              $ = layui.jquery,
              form = layui.form;
          $(window).on('load', function() {
              form.on('submit(admin)', function(data) {
                  //let data = $('#admin').serialize()
                  //data.id = {$data.id}
                  // console.log($('#admin').serialize())
                  // alert($('#admin').serialize())
                  $.ajax({
                      url:"{:url('admin/population/editData')}",
                      data: $('#admin').serialize(),
                      type:'post',
                      async: false,
                      success:function(res) {
                        if(res.code == 1) {
                            layer.alert('编辑成功',{icon:6},parent.location.reload());
                        }else {
                            layer.msg(res.msg);
                        }
                      }
                  })
                  return false;
              });
          });
      });
    </script>
  </div>
</body>
</html>